﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Data.Entity;
using System.Web;

namespace DataAbstractorExample.Models
{
    public class DataContextInitialiser : DropCreateDatabaseAlways<DataContext>
    {
        protected override void Seed(DataContext context)
        {
            base.Seed(context);

            var note = new Note { Created = DateTime.Now, Message = "This is a note" };
            context.Comments.Add(new Comment { From = "Bob", Message = "Wow what a great note", Note = note });
            context.Comments.Add(new Comment { From = "James", Message = "Here is another", Note = note });

            var blueSkyNote = new Note { Created = DateTime.Now, Message = "The sky is blue" };
            context.Comments.Add(new Comment { From = "Bob", Message = "Glad to hear the sky is blue", Note = blueSkyNote });
        }
    }
}